
#include "library.cpp"
typedef unsigned short WORD;//WORD表示16位无符号数

//char * raw_path = "/Users/WangZZ/code/lifanghui/ANN/data/test/1-2.raw";
// 金属物
//char * raw_path = "/Users/WangZZ/code/20200610spine/data/metal_A2.raw";
//char * raw_path = "/Users/WangZZ/code/20200610spine/data/metal_A2.raw";
// 噪声
char * raw_path = "/Users/WangZZ/code/lifanghui/ANN/data/train/0-1.raw";
const std::string image_path = "/Users/WangZZ/code/20200610spine/data/test/2-1.png";

int GetDataFromRawFile(char * rawFileName, WORD * pRawData);


int GetDataFromRawFile(char * rawFileName, WORD * pRawData)
{
    FILE *fp;
    long W = 1024;//��
    long H = 1024;//��
    WORD test = 0;

    if ((fp = fopen(rawFileName, "rb")) == 0)//����Ҫ�򿪵��ļ�
    {
        return NULL;
    }

    //WORD* imageData = new WORD[H*W];
    fread(pRawData, sizeof(WORD), H*W, fp);
    fclose(fp);

    return 0;
}


int main(int argc, const char* argv[]) {
    // 初始化参数
    char verStr[500];
    int rawIndex = 0;
    bool ABFg = true;
    int width = 1024;
    int height = 1024;
    int algorithmType = 0;
    int kv = 80;
    float mA = 100;
    int autoKvType = 0;
    int partType = 0;
    WORD newKv = 0;
    float newmA =  0;
    char * clsModelPATH = "/Users/WangZZ/CLionProjects/test_torch/partTypeClassifier.pt";
    WORD * pRawData = new WORD[width*height];

    GetPicAlgorithmVerInfo(verStr);
    printf("%s\r\n",verStr);

    GetDataFromRawFile(raw_path,pRawData);
    PicProc(pRawData,clsModelPATH,rawIndex,ABFg,width,height,algorithmType,
            kv,mA,autoKvType,partType,newKv,newmA);
    Mat image = raw2Mat(pRawData,1024,1024);
    cv::namedWindow("result", 1);
    cv::imshow("result", image);
    waitKey(0);



}